package com.qf.java2106.pojos;

import java.util.List;

/**
 * @author q
 * @version V1.0
 * @date 2021/10/19
 **/
public class PageBean<T> {

    /**
     * 当前页集合数据
     */
    private List<T> list;

    /**
     * 总条数
     */
    private Long totalCounts;

    /**
     * 总页数
     * 计算得到：总条数%每页数==0 ？ 总条数/每页数 ：总条数/每页数+1
     */
    private Integer totalPages;

    /**
     * 当前页
     */
    private Integer currentPage = 1;

    /**
     * 叶大小
     */
    private Integer pageSize = 6;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Long getTotalCounts() {
        return totalCounts;
    }

    public void setTotalCounts(Long totalCounts) {
        this.totalCounts = totalCounts;
    }

    public Integer getTotalPages() {
        return totalPages;
    }

    public void setTotalPages() {
        int counts = this.totalCounts.intValue();
        this.totalPages = counts%pageSize == 0 ? counts/pageSize : (counts/pageSize+1);
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public PageBean() {
    }
}
